<!DOCTYPE html>
<html lang="en">
<head>
    <title>大客户经理周拜访计划</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="Cache-Control" content="no-store, must-revalidate">
    <meta http-equiv="expires" content="Wed, 26 Feb 1997 08:21:57 GMT">
    <meta http-equiv="expires" content="-1">
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <style>
        [v-cloak] {
            display: none;
        }

        * {
            -webkit-box-sizing: border-box;
            -moz-box-sizing: border-box;
            box-sizing: border-box;
        }
        table{
            border-collapse: collapse;
            border-right:1px solid #cbcbcd;
            border-bottom:1px solid #cbcbcd;
            margin-left:0;
            margin-top:0;
            margin-bottom:-1px !important;
            margin-right:0;
        }
        th,td{
            border-top:1px solid #cbcbcd;
            border-left:1px solid #cbcbcd;
            color:#333;
            font-weight:normal;
            /*line-height:24px;*/
            padding-top:4px !important;
            padding-bottom:4px !important;
        }
        th{
            background-color: #F8F8F8;
        }
        .table-border-right-none{
            border-right-width:0px;
        }
        body {
            margin: 0.01rem;
        }
        table.text-center, table.text-center td, table.text-center th {
            text-align: center;
            font-size: 12px;
        }
        table td {
            padding:0.05rem 0.02rem;
            position: relative;
        }
        .table {
            width: 100%;
            max-width: 100%;
            margin-bottom: 0.2rem;
        }
        .hidden {
            display: none;
        }

        table input{
            border:none;
            width: 100%;
        }
        .table>tbody>tr>td, .table>tbody>tr>th, .table>tfoot>tr>td, .table>tfoot>tr>th, .table>thead>tr>td, .table>thead>tr>th{
            /*padding:0 6px;*/
            height:24px;
            vertical-align: middle;
        }
        .content {
            padding: 0 0.04rem;
        }
        .tit{background-color: #f8f8f8;line-height: 0.24rem;height: 0.24rem; font-weight: bold;}
        td.bd_none{padding:0 !important; border: 0 !important;    border-width: 0 !important;}
        .td-value {
            text-align: left !important;
            vertical-align: middle;
            word-wrap: break-word;
            border-bottom-width: 0px !important;
        }

        .td-value span{
            display: inline-block;
            max-height: 0.56rem;
            overflow: hidden;
            padding-left: 0.06rem;
            word-wrap: break-word;color: #2a8cec !important;
            border-bottom-width: 0px !important;
        }
        /*input{*/
            /*word-wrap: break-word;color: #2a8cec !important;*/
            /*font-size: 12px;*/
        /*}*/
        .jiaobiao{
            position: relative;
        }

        .jiaobiao i{
            display:block;
            width:0;
            height:0;
            border-width:0 0 .12rem .12rem;
            border-style:solid;
            border-color:transparent transparent transparent #2a8cec;
            position:absolute;
            top:0;
            left:0;
        }
        /*自动补全样式*/
          .wyui-autocomplete-panel {
              width: 250px;
              background: #fff;
              border: 1px solid #a0a0a0;
              border-radius: 3px;
              box-shadow: 0 1px 3px rgba(0,0,0,0.3);
              position: absolute;
              margin: 0px;
              padding: 0px;
              display: none;
              z-index: 9999;
              overflow: auto;
              overflow-x: hidden;
          }

        .wyui-autocomplete-panel ul {
            margin: 0px;
            list-style: none;
            text-align: left;
            width: 100%;
            padding: 2px 0;
        }

        .wyui-autocomplete-panel li {
            list-style: none;
            text-align: left;
            padding-left: 2px;
            cursor: pointer;
            line-height:24px;
        }

        .wyui-autocomplete-panel li.hover {
            background-color: #e6f2fa;
        }

        .wyui-autocomplete-panel li a {
            color: Black;
            text-decoration: none;
            text-align:left !important;
            height:20px;
            line-height:20px;
        }

        .wyui-autocomplete-panel li a:hover {
            text-decoration: none;
            color: Black;
        }
        button{
            display: flex;
            align-items: center;
            text-align: center;
            padding:0.02rem 0.06rem;
            margin:0.2rem auto;
        }
    </style>
</head>
<body>
<section class="content" id="app">
    <table class="table text-center" id="week">
        <tr v-for="(item,i) in list">
            <td width="5%" class="tit" :rowspan="item.weekNamespan" :class="{hidden: item.weekNamedis}">
                {{item.weekName}}<br>({{item.weekTime}})
            </td>
            <td class="bd_none">
                <table class="table text-center table-border-right-none">
                    <tr>
                        <th class="jiaobiao" style="width: 25%;"><i></i>客户名称 </th>
                        <td class="td-value" style="width: 25%;">
                            <span>{{item.customerName}}</span>
                        </td>
                        <th style="width:25%;">上次拜访时间 </th>
                        <td class="td-value">
                            <span>{{item.lastVisitTime}}</span>
                        </td>
                    </tr>
                    <tr>
                        <th>客户地点</th>
                        <td class="td-value">
                            <span>{{item.customerAddress}}</span>
                        </td>
                        <th>客户行业</th>
                        <td class="td-value">
                            <span>{{item.customerIndustry}}</span>
                        </td>
                    </tr>
                    <tr>
                        <th>意向设备</th>
                        <td colspan="3" class="td-value">
                            <span>{{item.intentionDevice}}</span>
                        </td>
                    </tr>
                    <tr>
                        <th>备注</th>
                        <td colspan="3" class="td-value">
                            <span>{{item.remake}}</span>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
    <!-- /.box-body -->
</section>

<!--rem.js-->
<script src="/dist/js/pages/rem/rem.js"></script>
<script src="https://file.ggxqce.com/web/jquery-2.2.3.min.js"></script>
<script src="https://file.ggxqce.com/web/vue.min.js"></script>
<script src="/dist/js/oaApp.js"></script>
<script type="text/javascript">
    console.log(urlConfig);
    var app = new Vue({
        el:'#app',
        data:{
            list:[],
            week:[]
        },
        methods:{
            tablesMergeCell: function (list) {
                for (field in list[0]) {
                    var k = 0;
                    while (k < list.length) {
                        list[k][field + 'span'] = 1;
                        list[k][field + 'dis'] = false;
                        for (var i = k + 1; i <= list.length - 1; i++) {
                            if (list[k][field] == list[i][field] && list[k][field] != '') {
                                list[k][field + 'span']++;
                                list[k][field + 'dis'] = false;
                                list[i][field + 'span'] = 1;
                                list[i][field + 'dis'] = true;
                            } else {
                                break;
                            }
                        }
                        k = i;
                    }
                }
                return list;
            },
            getWeek:function() {
                var that=this;
                const week = [];
                for (var i = 0; i < 6; i++) {
                    var Stamp = new Date();
                    var num = 7-Stamp.getDay() + 1 + i;
                    Stamp.setDate(Stamp.getDate() + num);
                    var mvar ='';
                    if((Stamp.getMonth() + 1)>10){
                        mvar = (Stamp.getMonth() + 1);
                    }else{
                        mvar =  '0' + (Stamp.getMonth() + 1);
                    }
                    var dvar ='';
                    if( Stamp.getDate()<10){
                        dvar = '0' +  Stamp.getDate();
                    }else{
                        dvar =  Stamp.getDate()+'';
                    }
                    if((Stamp.getMonth() + 1)>10){}else{}
                    week[i] = Stamp.getFullYear()+'-'+mvar +'-'+ dvar;
                    console.log(week[i]);
                }
                that.week=week;
            },

            getNowFormatDate: function () {
                var that=this;
                var date = new Date();
                var seperator1 = "-";
                var year = date.getFullYear();
                var month = date.getMonth() + 1;
                var strDate = date.getDate();
                if (month >= 1 && month <= 9) {
                    month = "0" + month;
                }
                if (strDate >= 0 && strDate <= 9) {
                    strDate = "0" + strDate;
                }
                var currentdate = year + seperator1 + month + seperator1 + strDate;
                return currentdate;
            },
            },
            mounted: function () {
            var that = this;
            if (getUrlParamObj().id){
                var data = {
                    createUserId: getUrlParamObj().id,
                    reportDate: that.getNowFormatDate(),
                }
                console.log(JSON.stringify(data))
                $.ajax({
                    url: server.ip + '/weekPlan/getWeek.json',
                    contentType: 'application/json;charset=utf-8',
                    type: "POST",
                    data: JSON.stringify(data),
                    success: function (r) {
                        var res = JSON.parse(r)
                        console.log(res)
                        that.list = res.data.sendData.records;
                        console.log(that.list)
                        this.list=that.tablesMergeCell(that.list);
                    },
                    error: function (e) {
                        alert(e.responseText)
                    }
                });
            }


        }
    });
</script>

</body>
</html>